﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Main.Master" Inherits="System.Web.Mvc.ViewPage<PagingResult<LiteratureManage.Domain.Models.Literature>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <div style="width:1000px;">
         <div><% Html.RenderPartial(MVC.Literature.Views.SearchBox, new LiteratureSearchViewModel()); %></div>
         <div style="padding: 5px 0 0 0;">
            <table id="searchList" class="table">
                <thead>
                    <tr>
                        <th style="width:50px;">编号</th>
                        <th style="width:auto;">文章名称</th>
                        <th style="width:150px;">学科类别</th>
                        <th style="width:150px;">文章来源</th>
                        <th style="width:100px;">发表日期</th>
                     </tr>
                </thead>
            <%if (Model.TotalItems > 0)
              { %>
                    <%foreach (var item in Model.Items)
                      {
                        %>
                        <tr class="table_row">
                            <td><%=item.Id %></td>
                            <td style=" text-align:left;"><%=item.ArticleName %></td>
                            <td><%=item.SubjectCatalog %></td>
                            <td><%=item.ArticleSource %></td>
                            <td><%=item.ArticlePublishDate.ToShortDateString() %></td>
                        </tr>
                     <%
                      } %>
            <%}
              else
              { %>
              <tr style="height:300px;">
                <td colspan="6">暂无任何结果</td>
              </tr>
            <%} %>
            </table>
            <div class="pages" style="padding:0; float:right;">
                <%=Html.Pager("page", Model.PageSize, Model.TotalItems) %>
            </div>  
        </div>
        <div style="clear:both;">
            <div id="panel_authors"></div>
            
        </div>
    </div>

    <script type="text/javascript">
        $(function() {
            var rows = $("#searchList .table_row");
            rows.click(function() {
                rows.each(function() { $(this).removeClass("highlight"); });
                $(this).removeClass("odd");
                $(this).addClass("highlight");
                $.get(
                    "<%=Url.Action(MVC.Literature.AjaxListAuthors()) %>",
                    { "literatureId": $("td:first", this).html() },
                    function(data, textStatus, xhr) {
                        $("#panel_authors").html(data);
                    },
                    "html");
            });
            rows.hover(
            function() {
                if ($(this).hasClass("highlight") == false)
                    $(this).addClass("odd");
            },
            function() {
                $(this).removeClass("odd");
            });
        });
    </script>
</asp:Content>
